﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace Snow_CSharp
{
    public partial class FormMain : Form
    {
        public FormMain()
        {
            InitializeComponent();
        }

        private void DrawWindowUI(ref Graphics gp)
        {
            //Bitmap img = (Bitmap)Bitmap.FromFile("back.png");
            //gp.DrawImage(img, 0, 0, 300, 200);

            Bitmap img2 = (Bitmap)Bitmap.FromFile("Rabbit01.png");
            gp.DrawImage(img2, 30, 30, 250, 150);
        }

        private void FormMain_Load(object sender, EventArgs e)
        {
            // 分层窗口
            FormBorderStyle = FormBorderStyle.None;
            //WindowState = FormWindowState.Maximized;
            //TopMost = true;
            Size = new Size(300, 200);

            Rectangle rcScreen = Screen.PrimaryScreen.Bounds;
            bm = new Bitmap(rcScreen.Height, rcScreen.Width);
            gpBM = Graphics.FromImage(bm);

            DrawWindowUI(ref gpBM);
            wnd32 = new LayeredWindowTool(this);
            wnd32.SetBitmap(bm);

            // 常规异形窗口
            // Size = new Size(400, 200);
            //Image img = Image.FromFile("Rabbit01.png");
            //BackgroundImage = img;
            //TransparencyKey = BackColor;
        }

        private Graphics gpBM;  // Bitmap Graphics
        private Bitmap bm;      // Bitmap
        LayeredWindowTool wnd32; // 分层窗口管理对象
    }
}
